//存
export const setItem = (key,value) => {
    if (typeof value === 'object') value = JSON.stringify(value)
    localStorage.setItem(key, value)
}
//取
export const getItem = key => {
    const data = window.localStorage.getItem(key)
    try {
      return  JSON.parse(data)
    } catch (error) {
      return  data
    }
}
